package handler

import (
	"github.com/gin-gonic/gin"
	"zg3zk3/dao"
	"zg3zk3/request"
)

func AddFocus(c *gin.Context) {
	var data request.AddFocus

	if err := c.ShouldBind(&data); err != nil {
		c.JSON(200, gin.H{
			"code": 200,
			"msg":  err.Error(),
			"data": nil,
		})
		return
	}
	userId := c.GetUint("userId")
	err := dao.CreateFocus(data.FollowId, int(userId))
	if err != nil {
		c.JSON(200, gin.H{
			"code": 200,
			"msg":  err.Error(),
			"data": nil,
		})
		return
	}
	c.JSON(200, gin.H{
		"code": 0,
		"msg":  "成功",
		"data": nil,
	})
}
